﻿using System;
using System.CodeDom.Compiler;
using System.Reflection;
using System.Runtime.CompilerServices;
using AutoR.ViewModels.Tasks;
using Prism.Mvvm;
using Syncfusion.ListView.XForms;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;
using Xamarin.Forms.Xaml.Internals;

namespace AutoR.Views.Tasks
{
	// Token: 0x0200001C RID: 28
	[XamlFilePath("Views\\Tasks\\ShipTypeSelect.xaml")]
	public class ShipTypeSelect : ContentPage
	{
		// Token: 0x0600007D RID: 125 RVA: 0x00011785 File Offset: 0x0000F985
		public ShipTypeSelect()
		{
			this.InitializeComponent();
		}

		// Token: 0x0600007E RID: 126 RVA: 0x00011793 File Offset: 0x0000F993
		private void Switch_OnToggled(object sender, ToggledEventArgs e)
		{
			ShipTypeSelectViewModel shipTypeSelectViewModel = (ShipTypeSelectViewModel)base.BindingContext;
			if (shipTypeSelectViewModel == null)
			{
				return;
			}
			shipTypeSelectViewModel.ChangeCommand.Execute();
		}

		// Token: 0x0600007F RID: 127 RVA: 0x000117B0 File Offset: 0x0000F9B0
		[GeneratedCode("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
		private void InitializeComponent()
		{
			if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(ShipTypeSelect).GetTypeInfo().Assembly.GetName(), "Views/Tasks/ShipTypeSelect.xaml") != null)
			{
				this.__InitComponentRuntime();
				return;
			}
			if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null)
			{
				this.__InitComponentRuntime();
				return;
			}
			BindingExtension bindingExtension = new BindingExtension();
			GridLayout gridLayout = new GridLayout();
			DataTemplate dataTemplate = new DataTemplate();
			SfListView sfListView = new SfListView();
			NameScope value = new NameScope();
			NameScope.SetNameScope(this, value);
			this.SetValue(ViewModelLocator.AutowireViewModelProperty, new bool?(true));
			this.SetValue(Page.TitleProperty, "舰船类型选择");
			bindingExtension.Path = "List";
			BindingBase binding = ((IMarkupExtension<BindingBase>)bindingExtension).ProvideValue(null);
			sfListView.SetBinding(SfListView.ItemsSourceProperty, binding);
			sfListView.SetValue(SfListView.AutoFitModeProperty, AutoFitMode.Height);
			sfListView.SetValue(SfListView.SelectionModeProperty, SelectionMode.None);
			gridLayout.SetValue(GridLayout.SpanCountProperty, 2);
			sfListView.SetValue(SfListView.LayoutManagerProperty, gridLayout);
			IDataTemplate dataTemplate2 = dataTemplate;
			ShipTypeSelect.<InitializeComponent>_anonXamlCDataTemplate_34 <InitializeComponent>_anonXamlCDataTemplate_ = new ShipTypeSelect.<InitializeComponent>_anonXamlCDataTemplate_34();
			object[] array = new object[0 + 3];
			array[0] = dataTemplate;
			array[1] = sfListView;
			array[2] = this;
			<InitializeComponent>_anonXamlCDataTemplate_.parentValues = array;
			<InitializeComponent>_anonXamlCDataTemplate_.root = this;
			dataTemplate2.LoadTemplate = new Func<object>(<InitializeComponent>_anonXamlCDataTemplate_.LoadDataTemplate);
			sfListView.SetValue(SfListView.ItemTemplateProperty, dataTemplate);
			this.SetValue(ContentPage.ContentProperty, sfListView);
		}

		// Token: 0x06000080 RID: 128 RVA: 0x0001191D File Offset: 0x0000FB1D
		private void __InitComponentRuntime()
		{
			this.LoadFromXaml(typeof(ShipTypeSelect));
		}

		// Token: 0x0200001D RID: 29
		[CompilerGenerated]
		private sealed class <InitializeComponent>_anonXamlCDataTemplate_34
		{
			// Token: 0x06000082 RID: 130 RVA: 0x00011944 File Offset: 0x0000FB44
			internal object LoadDataTemplate()
			{
				BindingExtension bindingExtension = new BindingExtension();
				Label label = new Label();
				BindingExtension bindingExtension2 = new BindingExtension();
				Switch @switch = new Switch();
				StackLayout stackLayout = new StackLayout();
				Frame frame = new Frame();
				NameScope value = new NameScope();
				NameScope.SetNameScope(frame, value);
				frame.SetValue(Frame.OutlineColorProperty, Color.Black);
				frame.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(4.0));
				frame.SetValue(View.MarginProperty, new Thickness(3.0));
				stackLayout.SetValue(StackLayout.OrientationProperty, StackOrientation.Horizontal);
				bindingExtension.Path = "Name";
				BindingBase binding = ((IMarkupExtension<BindingBase>)bindingExtension).ProvideValue(null);
				label.SetBinding(Label.TextProperty, binding);
				label.SetValue(View.VerticalOptionsProperty, LayoutOptions.Center);
				stackLayout.Children.Add(label);
				bindingExtension2.Path = "Selected";
				BindingBase binding2 = ((IMarkupExtension<BindingBase>)bindingExtension2).ProvideValue(null);
				@switch.SetBinding(Switch.IsToggledProperty, binding2);
				@switch.SetValue(View.HorizontalOptionsProperty, LayoutOptions.EndAndExpand);
				@switch.Toggled += this.root.Switch_OnToggled;
				stackLayout.Children.Add(@switch);
				frame.SetValue(ContentView.ContentProperty, stackLayout);
				return frame;
			}

			// Token: 0x04000046 RID: 70
			internal object[] parentValues;

			// Token: 0x04000047 RID: 71
			internal ShipTypeSelect root;
		}
	}
}
